/* 移动端专用样式 */
@media (max-width: 768px) {
    /* 基础样式调整 */
    body {
        font-size: 14px;
        padding-top: 56px; /* 为固定顶部导航栏留出空间 */
    }

    /* 导航栏调整 */
    .navbar {
        height: 56px;
        padding: 0.5rem 1rem;
        background-color: var(--card-background);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .navbar-brand {
        font-size: 1.2rem;
        margin-right: auto;
    }

    .nav-text {
        font-size: 0.9rem;
        color: var(--text-secondary);
        padding: 0.25rem 0.5rem;
        background: var(--background-color);
        border-radius: 0.375rem;
    }

    /* 导航栏下拉菜单优化 */
    .navbar-collapse {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background-color: var(--card-background);
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1030;
        max-height: calc(100vh - 56px);
        overflow-y: auto;
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        transition: background-color 0.2s ease;
    }

    .nav-link:hover {
        background-color: var(--background-color);
    }

    .navbar-toggler {
        padding: 0.5rem;
        border: none;
        color: var(--text-primary);
    }

    .navbar-toggler:focus {
        box-shadow: none;
    }

    /* 主内容区域 */
    .main-content {
        padding: 1rem 0.5rem 4rem; /* 底部增加padding为底部工具栏留出空间 */
        margin-top: 0;
    }

    .container {
        padding: 0 0.75rem;
        max-width: 100%;
    }

    /* 卡片样式优化 */
    .card {
        border-radius: 0.75rem;
        margin: 0.75rem 0;
        border: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        background: var(--card-background);
    }

    .card-header {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        background: transparent;
        font-weight: 600;
    }

    .card-body {
        padding: 1rem;
    }

    /* 文件列表优化 */
    .file-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .file-item {
        background: var(--card-background);
        border-radius: 0.75rem;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        border: 1px solid var(--border-color);
    }

    .file-info {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }

    .file-name {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
        word-break: break-word;
        line-height: 1.4;
    }

    .file-meta {
        font-size: 0.9rem;
        color: var(--text-secondary);
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    /* 按钮样式优化 */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.95rem;
        border-radius: 0.5rem;
        font-weight: 500;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        transition: all 0.2s ease;
    }

    .btn i {
        font-size: 1.1rem;
    }

    .btn:active {
        transform: scale(0.98);
    }

    /* 表单样式优化 */
    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-label {
        font-size: 0.95rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
        color: var(--text-primary);
    }

    .form-control {
        font-size: 1rem;
        padding: 0.75rem;
        height: auto;
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
        background: var(--background-color);
    }

    .form-control:focus {
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
        border-color: var(--primary-color);
    }

    /* 底部工具栏优化 */
    .mobile-toolbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-background);
        padding: 0.75rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        gap: 0.75rem;
        backdrop-filter: blur(10px);
    }

    .mobile-toolbar .btn {
        flex: 1;
        padding: 0.625rem;
        font-size: 1.1rem;
        border-radius: 0.5rem;
        background: var(--background-color);
        color: var(--text-primary);
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .mobile-toolbar .btn i {
        font-size: 1.25rem;
    }

    .mobile-toolbar .btn:active {
        background: var(--border-color);
    }

    /* 警告框样式优化 */
    .alert {
        margin: 0.75rem 0;
        padding: 1rem;
        border-radius: 0.75rem;
        border: none;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        background: var(--background-color);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }

    .alert i {
        font-size: 1.25rem;
    }

    /* PDF查看器布局 */
    .pdf-viewer {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* 减去顶部导航栏的高度 */
        background: #f8f9fa;
    }

    .pdf-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        background: white;
        border-bottom: 1px solid #e9ecef;
        z-index: 10;
    }

    .toolbar-buttons {
        display: flex;
        gap: 10px;
    }

    .page-info {
        font-size: 0.9rem;
        color: #6c757d;
    }

    .pdf-container {
        flex: 1;
        position: relative;
        overflow: hidden;
        background: #f1f3f4;
    }

    .pages-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
        padding: 20px;
        background: #f1f3f4;
    }

    .pdf-page-container {
        margin: 0 auto 20px;
        display: flex;
        justify-content: center;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        border-radius: 4px;
    }

    .pdf-page-container:last-child {
        margin-bottom: 0;
    }

    .pdf-page {
        max-width: 100%;
        height: auto;
        display: block;
        border-radius: 4px;
    }

    /* 全屏模式样式 */
    .pdf-container:fullscreen {
        background: #2d3748;
        padding: 0;
    }

    .pdf-container:fullscreen .pages-container {
        padding: 20px;
        background: #2d3748;
    }

    .pdf-container:fullscreen .pdf-page-container {
        margin: 10px auto;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    /* 移动端优化 */
    @media (max-width: 768px) {
        .pdf-viewer {
            height: calc(100vh - 56px); /* 移动端导航栏更小 */
        }

        .pdf-toolbar {
            padding: 8px 12px;
        }

        .pages-container {
            padding: 10px;
        }

        .pdf-page-container {
            margin: 0 auto 10px;
        }
    }

    /* 加载指示器 */
    .loading-indicator {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 12px 24px;
        border-radius: 6px;
        font-size: 14px;
        z-index: 1000;
    }

    /* 暗色模式 */
    @media (prefers-color-scheme: dark) {
        .pdf-viewer {
            background: #1a1a1a;
        }

        .pdf-toolbar {
            background: #2d2d2d;
            border-bottom-color: #404040;
        }

        .page-info {
            color: #a0aec0;
        }

        .pdf-container {
            background: #262626;
        }

        .pages-container {
            background: #262626;
        }

        .pdf-page-container {
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
    }

    /* 页面控制按钮优化 */
    .page-controls {
        opacity: 0.8;
    }

    .page-control {
        width: 40px;
        height: 60px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 4px;
    }

    /* 触摸反馈 */
    .pdf-container:fullscreen.swiping-left::after,
    .pdf-container:fullscreen.swiping-right::after {
        content: "";
        position: fixed;
        top: 0;
        bottom: 0;
        width: 40px;
        background: rgba(255, 255, 255, 0.1);
        transition: opacity 0.2s ease;
    }

    .pdf-container:fullscreen.swiping-left::after {
        right: 0;
    }

    .pdf-container:fullscreen.swiping-right::after {
        left: 0;
    }

    /* PDF全屏控件移动端优化 */
    .page-controls {
        padding: 0 0.5rem;
    }

    .page-control {
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.4);
    }

    .page-control i {
        font-size: 1rem;
    }

    /* 添加触摸提示 */
    .pdf-container:fullscreen::after {
        content: "左右滑动翻页";
        position: fixed;
        bottom: 2rem;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.6);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 2rem;
        font-size: 0.9rem;
        opacity: 1;
        transition: opacity 0.3s ease;
        animation: fadeOut 3s forwards;
    }

    @keyframes fadeOut {
        0% { opacity: 1; }
        70% { opacity: 1; }
        100% { opacity: 0; }
    }

    /* 横屏模式优化 */
    @media (orientation: landscape) {
        .page-controls {
            padding: 0 1.5rem;
        }

        .pdf-container:fullscreen::after {
            bottom: 1rem;
        }
    }

    /* 搜索框优化 */
    .search-container {
        margin: 0.75rem 0;
        position: relative;
    }

    .search-input {
        width: 100%;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 1rem;
        border-radius: 0.75rem;
        border: 1px solid var(--border-color);
        background: var(--background-color);
    }

    .search-container i {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
        font-size: 1.1rem;
    }

    /* 分页优化 */
    .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
        justify-content: center;
        margin: 1.25rem 0;
    }

    .page-link {
        padding: 0.5rem 0.875rem;
        font-size: 0.95rem;
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
        background: var(--card-background);
        color: var(--text-primary);
    }

    .page-link:active {
        background: var(--background-color);
    }

    /* PDF连续滚动视图样式 */
    .pages-container {
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
        background: #2d3748;
        padding: 20px;
    }

    .pdf-page-container {
        margin: 0 auto 20px;
        display: flex;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        background: white;
    }

    .pdf-page {
        width: 100%;
        height: auto;
        display: block;
    }

    /* 全屏模式优化 */
    .pdf-container:fullscreen .pages-container {
        padding: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .pdf-container:fullscreen .pdf-page-container {
        max-width: 95vw;
        margin: 10px auto;
    }

    /* 加载指示器 */
    .loading-indicator {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 15px 30px;
        border-radius: 8px;
        z-index: 1000;
    }

    /* 移动端优化 */
    @media (max-width: 768px) {
        .pages-container {
            padding: 10px;
        }

        .pdf-page-container {
            margin: 0 auto 10px;
        }

        .pdf-container:fullscreen .pdf-page-container {
            max-width: 98vw;
            margin: 5px auto;
        }
    }

    /* 横屏模式优化 */
    @media (orientation: landscape) {
        .pdf-container:fullscreen .pdf-page-container {
            max-height: 98vh;
            width: auto;
        }

        .pdf-container:fullscreen .pdf-page {
            height: 98vh;
            width: auto;
        }
    }

    /* 暗色模式适配 */
    @media (prefers-color-scheme: dark) {
        .mobile-toolbar {
            background: rgba(var(--card-background-rgb), 0.8);
        }

        .search-input,
        .form-control {
            background: var(--card-background);
        }
    }
}
